<!-- BEGIN CONTENT -->
  <div class="col-md-9 col-sm-7">
	<div class="row list-view-sorting clearfix">
	  <div class="col-md-2 col-sm-2 list-view">
		<a href="#"><i class="fa fa-th-large"></i></a>
		<a href="#"><i class="fa fa-th-list"></i></a>
	  </div>
	  <div class="col-md-10 col-sm-10">
		<div class="pull-right">
		  <label class="control-label">Loại:</label>
		  <select class="form-control input-sm" id="sortType">
			<option value="sortBy=stt&sortOrder=desc" <?php
			if($pag['sortBy'] == 'id' && $pag['sortOrder'] == 'desc')
				echo 'selected="selected"' ?>>Mới nhất</option>
			<option value="sortBy=stt&sortOrder=asc" <?php
			if($pag['sortBy'] == 'id' && $pag['sortOrder'] == 'asc')
				echo 'selected="selected"' ?>>Cũ nhất</option>
			<option value="sortBy=ten&sortOrder=asc" <?php
			if($pag['sortBy'] == 'name' && $pag['sortOrder'] == 'asc')
				echo 'selected="selected"' ?>>Tên (A - Z)</option>
			<option value="sortBy=ten&sortOrder=desc" <?php
			if($pag['sortBy'] == 'name' && $pag['sortOrder'] == 'desc')
				echo 'selected="selected"' ?>>Tên (Z - A)</option>
			<option value="sortBy=gia&sortOrder=asc" <?php
			if($pag['sortBy'] == 'price' && $pag['sortOrder'] == 'asc')
				echo 'selected="selected"' ?>>Giá (Thấp &gt; Cao)</option>
			<option value="sortBy=gia&sortOrder=desc" <?php
			if($pag['sortBy'] == 'price' && $pag['sortOrder'] == 'desc')
				echo 'selected="selected"' ?>>Giá (Cao &gt; Thấp)</option>
		  </select>
		</div>
	  </div>
	</div>
	<!-- BEGIN PRODUCT LIST -->
	<div class="row product-list"><?php
	if(!empty($product)):
		foreach($product as $v):
			$img = $v->getImage();
			if(empty($img)):
				$img = $thumb = base_url('/assets/img/notfound.jpg');
			else:
				$thumb = base_url('/assets/upload/thumbs/'.$img->getName());
				$img = base_url('/assets/upload/'.$img->getName());
			endif;
	  ?><!-- PRODUCT ITEM START -->
	  <div class="col-md-4 col-sm-6 col-xs-12">
		<div class="product-item">
		  <div class="pi-img-wrapper">
			<img src="<?php echo $img; ?>" class="img-responsive" style="width:238px;height:254px;" alt="Berry Lace Dress">
			<div>
			  <a href="<?php echo $img; ?>" class="btn btn-default fancybox-button">Phóng to</a>
			  <a href="<?php echo base_url('/product/view/'.$v->getId()); ?>" class="btn btn-default fancybox-fast-view">Xem</a>
			</div>
		  </div>
		  <h3><a href="shop-item.html"><?php echo html_escape($v->getName()); ?></a></h3>
		  <div class="pi-price"><?php echo $v->getPrice(); ?> Đ</div>
		  <a href="#" class="btn btn-default add2cart">Thêm vào giỏ</a>
		</div>
	  </div><?php
		endforeach;
	 endif;
	  ?><!-- PRODUCT ITEM END -->
	</div>
	<!-- END PRODUCT LIST -->
	<!-- BEGIN PAGINATOR -->
	<div class="row">
	  <div class="col-md-4 col-sm-4 items-info">Tổng cộng <?php echo $pag['total_rows']; ?> sản phẩm</div>
	  <div class="col-md-8 col-sm-8 text-right"><?php
		echo $pagination_link;
		
	  ?></div>
	</div>
	<!-- END PAGINATOR -->
  </div>
  <!-- END CONTENT -->
  <script>
$('#sortType').change(function(){
	var url = window.location.hostname + window.location.pathname + '?' + $(this).val();
	console.log(url);
	location.href='http://'+url;
});
</script>
</div>